FROM php:7.4-cli
LABEL maintainer="lion 1934001@qq.com"
LABEL version="20210704"
LABEL description="php7.4-cli"
WORKDIR /var/www
RUN set -eux; \
APT_INSTALL="apt-get install -y --no-install-recommends" \
&& PHP_DEP_LIB="zip unzip git libzip4 libfreetype6 libpng16-16 libjpeg62-turbo libwebp6 libc-client2007e ibevent-2.1-6 libevent-core-2.1-6 libevent-extra-2.1-6 libevent-openssl-2.1-6" \
&& PHP_DEP_LIB_DEV="libzip-dev libfreetype6-dev libpng-dev libjpeg-dev libwebp-dev zlib1g-dev libevent-dev libssl-dev libgmp-dev libc-client2007e-dev libkrb5-dev" \
&& PHP_INSTALL_EXT="bcmath pcntl pdo_mysql sockets zip gmp gd imap shmop" \
&& PECL_INSTALL_EXT="event igbinary lzf mongodb redis" \
# 安装composer
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php composer-setup.php && php -r "unlink('composer-setup.php');" \
&& mv composer.phar /usr/local/bin/composer.phar && ln -s /usr/local/bin/composer.phar /usr/local/bin/composer \
&& apt-get update \
#安装依赖库
&& ${APT_INSTALL} ${PHP_DEP_LIB} \
#安装开发相关头文件
&& ${APT_INSTALL} ${PHP_DEP_LIB_DEV} \
&& docker-php-source extract \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
&& docker-php-ext-install ${PHP_INSTALL_EXT} \
&& pecl install ${PECL_INSTALL_EXT} && docker-php-ext-enable ${PECL_INSTALL_EXT} \
#清理
&& apt-get purge -y ${PHP_DEP_LIB_DEV} \
&& apt-get autoremove -y && apt-get clean \
&& docker-php-source delete \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/* \
&& unset PHP_DEP_LIB PHP_DEP_LIB_DEV PHP_INSTALL_EXT PECL_INSTALL_EXT
ENTRYPOINT ["docker-php-entrypoint"]
CMD ["php", "-a"]